package vn.aptech.scrumgroup.activity;

import vn.aptech.scrumgroup.R;
import vn.aptech.scrumgroup.ui.ArtifactView;
import vn.aptech.scrumgroup.util.DrawUtil;
import vn.aptech.scrumgroup.util.MenuUtil;
import android.app.Activity;
import android.app.Dialog;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;

public class ArtifactsActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		 requestWindowFeature(Window.FEATURE_NO_TITLE);
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
         int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
         int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
         DrawUtil.calculateUnit(screenWidth, screenHeight);
         setContentView(new ArtifactView(this));	
    }
    
    @Override
	protected Dialog onCreateDialog(int id) {
		// TODO Auto-generated method stub
    	switch(id){
    	case MenuUtil.EXIT_ITEM_ID:
    		return MenuUtil.createConfirmDialog(this, R.drawable.ic_launcher, this.getResources().getString(R.string.EXIT_CONFIRM_QUESTION), null);
    	case MenuUtil.ABOUT_ITEM_ID:
    		return MenuUtil.createAlertDialog(this, R.drawable.scrumbook_icon, "This is an application of ScrumLab", this.getResources().getString(R.string.ABOUT_TITLE));
    	}
		return super.onCreateDialog(id);
	}
    @Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		MenuUtil.createMenu(menu);
		return super.onCreateOptionsMenu(menu);
	}
	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		// TODO Auto-generated method stub
		MenuUtil.menuSelected(featureId, item, this);
		return super.onMenuItemSelected(featureId, item);
	}
}
